<!doctype html>
<html lang="en">
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>言成言成啊</title>
    <link rel="shortcut icon" href="/images/favicon.ico">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/meethigher/cdn@9.0/css/meethigher-font.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/meethigher/cdn@9.0/css/animate.css">
    <link rel="stylesheet" href="/css/index.css">
</head>
<body>
<header class="header">
    <div class="header-menu"><span class="fa fa-bars"></span></div>
    <div class="header-search"><span class="fa fa-search"></span></div>
    <div class="header-title"><a href="/">言成言成啊 | <span class="header-subtitle">Kit Chen&#39;s Blog</span></a></div>
    <ul class="header-navbar clearFix">
        
            <li><a href="/">主页</a></li>
        
            <li><a href="/tags">标签</a></li>
        
            <li><a href="/archives">归档</a></li>
        
            <li><a href="/search">导航</a></li>
        
    </ul>
</header>
<main class="main">
    <div class="main-content meethigher-scroll">
    <article class="post">
        <div class="post-title">
            <h2 class="title">hexo提交项目</h2>
        </div>
        <div class="post-media2">
            <span class="post-time">2019-11-04</span>
            
                <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/git/">git</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/hexo/">hexo</a></li></ul>
            
        </div>
        <div class="post-content blog-markdown">
            <p>先看<a href="https://hexo.io/zh-cn/docs/contributing.html#%E6%9B%B4%E6%96%B0%E6%96%87%E6%A1%A3" target="_blank" rel="noopener">官方文档</a>，是这样描述的。</p>
<img src="/2019/11/04/hexo-submit/工作流程.png" title="工作流程">

<h3 id="1-Fork-hexojs-hexo"><a href="#1-Fork-hexojs-hexo" class="headerlink" title="1. Fork hexojs/hexo"></a>1. Fork <a href="hexojs/hexo">hexojs/hexo</a></h3><p>当时整了一上午，没整明白。当时git clone下来之后，修改完了打算上传上去，发现一直提示没有权限。越想越想不通。然后下午就去忙别的事情了，当时随意看了一眼官方文档，发现，原来需要<code>fork</code>！<code>fork</code>理解为<code>分支</code>的意思吧</p>
<img src="/2019/11/04/hexo-submit/fork.png" title="fork">

<p>然后再去自己的项目里，就会看到已经<code>fork</code>到自己的项目了。</p>
<img src="/2019/11/04/hexo-submit/fork2.png" title="fork">

<h3 id="2-把库（respository）复制到电脑上，并安装所依赖的插件"><a href="#2-把库（respository）复制到电脑上，并安装所依赖的插件" class="headerlink" title="2. 把库（respository）复制到电脑上，并安装所依赖的插件"></a>2. 把库（respository）复制到电脑上，并安装所依赖的插件</h3><p>将你的<code>fork</code>的库下载到你的电脑上，并安装所依赖的插件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$ git clone https://github.com/meethigher/site</span><br><span class="line">$ cd hexo </span><br><span class="line">$ npm install</span><br><span class="line">$ git submodule update --init</span><br></pre></td></tr></table></figure>

<p>当时在这一步也出了问题，<code>npm install</code>的时候出现了卡顿的情况，后来翻墙了也没用，看来我大清国闭关锁国得挺严重啊！不过国内提供了<a href="https://npm.taobao.org/" target="_blank" rel="noopener">淘宝镜像</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">//查看npm的默认安装源</span><br><span class="line">$ npm config get registry</span><br><span class="line">https://registry.npmjs.org/</span><br><span class="line"></span><br><span class="line">//修改npm的默认安装源为淘宝npm镜像</span><br><span class="line">$ npm config set registry https://registry.npm.taobao.org</span><br></pre></td></tr></table></figure>

<h3 id="3-新增一个功能分支"><a href="#3-新增一个功能分支" class="headerlink" title="3. 新增一个功能分支"></a>3. 新增一个功能分支</h3><p>新增功能分支</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git checkout -b new_feature</span><br></pre></td></tr></table></figure>

<h3 id="4-开始开发"><a href="#4-开始开发" class="headerlink" title="4. 开始开发"></a>4. 开始开发</h3><p>coding……</p>
<h3 id="5-推送（push）分支"><a href="#5-推送（push）分支" class="headerlink" title="5. 推送（push）分支"></a>5. 推送（push）分支</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ git add .</span><br><span class="line">$ git commit -m &quot;更新日志&quot;</span><br><span class="line">$ git push origin new_feature</span><br></pre></td></tr></table></figure>

<p>我在推送分支的时候，碰到了一堆错误，后来网上搜了一下，发现是<code>检测代码规范机制</code>。</p>
<p>详情点击链接：<a href="https://www.jianshu.com/p/f0d31f92bfab" target="_blank" rel="noopener">git commit前检测husky与pre-commit</a></p>
<p>这里提供一种解决方案，在提交时加入<code>--no-verify</code>参数，用来跳过检测机制</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git commit --no-verify -m &quot;更新日志&quot;</span><br></pre></td></tr></table></figure>

<h3 id="6-建立一个新的合并申请（pull-request）并描述改动"><a href="#6-建立一个新的合并申请（pull-request）并描述改动" class="headerlink" title="6. 建立一个新的合并申请（pull request）并描述改动"></a>6. 建立一个新的合并申请（pull request）并描述改动</h3><p>点击项目上的<code>pull request</code>去请求</p>
<img src="/2019/11/04/hexo-submit/pullrequest.png" title="pullrequest">

<p>写上我们的更新日志和更改了啥东西，然后点击<code>create pull request</code></p>
<p>然后就没我们啥事了，我们只要等待作者收到邮件同意我们的更新就好了。</p>
<h2 id="7-激动人心的时刻"><a href="#7-激动人心的时刻" class="headerlink" title="7. 激动人心的时刻"></a>7. 激动人心的时刻</h2><p>经过一天的折腾，成功被大佬approve到master了</p>
<img src="/2019/11/04/hexo-submit/happy.png" title="happy">
        </div>
        
            <div class="busuanzi">
                <span id="busuanzi_container_page_pv">阅读量<span id="busuanzi_value_page_pv"></span>次</span>
                <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
            </div>
        
    </article>
</div>
    <pointer href="javascript:void(0);" class="arrow fa fa-arrow-up"></pointer>
<pointer href="javascript:void(0);" class="arrow fa fa-arrow-down"></pointer>

</main>
<aside class="aside">
    <div class="aside-content">
        <div class="aside-avatar"><img src="/images/kitchen.jpg" alt="言成"></div>
        <div class="aside-author">言成</div>
        <div class="aside-description">爱学习，爱运动，爱看妹子</div>
        <ul class="aside-contact clearFix">
            <li><span class="fa fa-github"></span><a href="https://github.com/meethigher">Github</a></li>
            <li><span class="fa fa-envelope"></span><a href="javascript:void(0);">meethigher@qq.com</a></li>
            <li><span class="fa fa-weixin"></span><a href="javascript:void(0);"><img src="/images/weixin.png" alt="扫描微信二维码，加我哦！"></a></li>
        </ul>
    </div>
</aside>
<div class="toolbar"><span class="fa fa-th"></span></div>
<div id="particles-js"></div>
<script src="https://cdn.jsdelivr.net/gh/meethigher/cdn@9.0/js/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/meethigher/cdn@9.0/js/particles.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/meethigher/cdn@9.0/js/app.js"></script>
<script src="/js/meethigher.js"></script>
<script src="/js/toolbar.js"></script>
</body>
</html>